package com.ymatou.iapi.couponmanage.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*根据用户Id列表创建发券任务Call
*FreeMaker Template自动生成代码
*/
public class createTaskByUserIdCall extends YmatouBaseCall{
	private static String opurl ="api/task/createTaskByUserId";
	
	public createTaskByUserIdCall() {
		super(EnvSetup.getSystemUrl("couponmanage_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取Data
	 * 
	 * @return
	 */
	public String getData() {
		return getString("data");	
	}
	/**
	 * 获取Data
	 * 
	 * @return
	 */
	public String getMessage() {
		return getString("message");	
	}
	/**
	 * 获取getErrorMessage
	 * 
	 * @return
	 */
	public String getErrorMessage() {
		String message = null;
		try {
			message = new JSONObject(getData()).getString("errorMessage");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return message;
	}
	
	/**
	 * 获取errorCode
	 * 
	 * @return
	 */
	public int getErrorCode1() {
		int Code = 0;
		try {
			Code = new JSONObject(getData()).getInt("errorCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取errorCode
	 * 
	 * @return
	 */
	public int getTaskId() {
		int Code = 0;
		try {
			Code = new JSONObject(getData()).getInt("taskId");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
}